//
//  PushSecondCell.m
//  HYHOME
//
//  Created by Mac on 16/2/23.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "PushSecondCell.h"
#import "SpeakModel.h"
#import "UIImageView+WebCache.h"
#import "DKNightVersion.h"


#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height

@implementation PushSecondCell


- (void)dealloc{

    [_content release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        [self createSubViews];
        
        
        
    }


    return self;
}

- (void)createSubViews{


    self.content = [[UILabel alloc]init];
    
    self.content.font = [UIFont systemFontOfSize:15];
   
    self.content.numberOfLines = 0;
    
    [self.contentView addSubview:self.content];
    

    [self.content release];
}


- (void)layoutSubviews{
    [super layoutSubviews];


    
    self.content.frame = CGRectMake(10, 10, self.frame.size.width - 10, [[self class]heightForLabel:self.content.text]);
    




}


+ (CGFloat)heightForLabel:(NSString *)text{
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 40, 0) options: NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]} context:nil];
    return rect.size.height;
}

+ (CGFloat)heightForCell:(SpeakModel *)model{
    
    CGFloat height =  [PushSecondCell heightForLabel:model.content];
    

    return height;
    
}

//- (void)passModel:(SpeakModel *)model image:(NSString *)image {
- (void)passModel:(SpeakModel *)model {
    
  
    self.content.text = model.content;
      self.content.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor lightGrayColor]);
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
